﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics.Contracts;

namespace BE.Web.Betfair.Interface.Requests
{
    /// <summary>
    /// 
    /// </summary>
    /// <typeparam name="TResponse">The type of the response.</typeparam>
    public class SessionBasedRequest<TResponse> : BE.EBC.Request.RequestResponse<TResponse>
    {
        [ContractInvariantMethod]
        void ObjectInvariant()
        {
            Contract.Invariant(this.Session != null);
        }

        /// <summary>
        /// Gets or sets the session.
        /// </summary>
        /// <value>The session.</value>
        public Session Session { get; private set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="SessionBasedRequest&lt;TResponse&gt;"/> class.
        /// </summary>
        /// <param name="session">The session.</param>
        /// <param name="completedAction">The completed action.</param>
        public SessionBasedRequest(Session session,Action<TResponse> completedAction) : base(completedAction)
        {
            #region conditions
            Contract.Requires<ArgumentNullException>(session != null);
            Contract.Ensures(this.Session != null);
            #endregion

            this.Session = session;
        }
    }
}
